package com.neusoft.resturant.controller;

import com.neusoft.resturant.common.utils.R;
import com.neusoft.resturant.entity.ResShop;
import com.neusoft.resturant.service.IResShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/shop")
public class ResShopController {
    @Autowired
    private IResShopService resShopService;

    /**
     * 查询店铺列表
     */
    @GetMapping("/list")
    public R list(ResShop resShop)
    {
        List<ResShop> list = resShopService.selectResShopList(resShop);
        return R.success(list);
    }


    /**
     * 获取店铺详细信息
     */
    @GetMapping(value = "/{id}")
    public R getInfo(@PathVariable("id") Long id)
    {

        return R.success(resShopService.selectResShopById(id));
    }

    /**
     * 新增店铺
     */
    @PostMapping
    public R add(@RequestBody ResShop resShop)
    {
        return R.toAjax(resShopService.insertResShop(resShop));
    }

    /**
     * 修改店铺
     */
    @PutMapping
    public R edit(@RequestBody ResShop resShop)
    {
        return R.toAjax(resShopService.updateResShop(resShop));
    }

    /**
     * 删除店铺
     */
    /*@DeleteMapping("/{id}")
    public R remove(@PathVariable Long id)
    {
        return R.toAjax(resShopService.deleteResShopById(id));
    }
    */
}
